<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php
session_start();

include '../class/TemplateClass.php';
include '../component/ComboboxClass.php';
include_once '../../db/DataBaseClass.php';
$id = $_GET['id'];

$row = DataBaseClass::SELECT_ONE_BY_ID("tb_usuario", "cod_usuario", "" . $id);

$nome = $row['nome'];
$cpf = $row['cpf'];
$email = $row['email'];
$cargo = $row['cod_cargo'];
$telefoneFixo = $row['telefone_fixo'];
$telefoneCelular = $row['telefone_celular'];
$perfil = $row['cod_perfil'];
?>

<html>
    <head>
        <meta charset="UTF-8">
        <title>
            <?php
            TemplateClass::TITLE();
            ?>
        </title>
        <?php
        TemplateClass::LIB("../");
        ?>

        <script src="../js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="../js/jquerymask/jquery.maskedinput.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function() {

                $("#cpf").mask("999.999.999-99");
                $("#telefone_fixo").mask("(99)9999-9999");
                $("#telefone_celular").mask("(99)9999-9999");

                $("#nome").val("<?php echo $nome ?>");
                $("#cpf").val("<?php echo $cpf ?>");
                $("#email").val("<?php echo $email ?>");
                $("#cargo").val("<?php echo $cargo ?>");
                $("#telefone_fixo").val("<?php echo $telefoneFixo ?>");
                $("#telefone_celular").val("<?php echo $telefoneCelular ?>");
                $("#perfil").val("<?php echo $perfil ?>");




            });

        </script>
    </head>
    <body>
        <div class="navbar navbar-default">
            <div class="container">
                <?php
                TemplateClass::MENU_BAR("../");
                ?>


            </div>
        </div>


        <div class="container small">
            <?php TemplateClass::UPDATE_HEADER("Editar Usuário") ?>
            <div id="message">
                <?php
                include_once '../component/MessageClass.php';
                MessageClass::show();
                ?>
            </div>



            <form method="POST" action="../../model/UsuarioAtualizarController.php?id=<?php echo $id ?>">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">Dados do Usuário</h3>
                    </div>
                    <div class="panel-body">
                        <div class="form-group">
                            <div class="row">
                                <div class="col-md-12">  
                                    <label for="inputEmail"><span class="mandatory_field">*</span> Nome:</label>
                                    <input required type="text" class="form-control" id="nome" name="nome" placeholder="Digite aqui o nome completo do usuário">
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-3">   
                                    <label for="inputEmail"><span class="mandatory_field">*</span> CPF:</label>
                                    <input required type="text" class="form-control" id="cpf" name="cpf" placeholder="Digite o CPF" disabled="">
                                </div>
                                <div class="col-md-4">   
                                    <label for="inputEmail"><span class="mandatory_field">*</span> E-mail:</label>
                                    <input required type="email" class="form-control" id="email" name="email" placeholder="Digite o e-mail institucional">
                                </div>
                                <div class="col-md-5">
                                    <label for="inputPassword"><span class="mandatory_field">* </span>Cargo</label>
                                    <select required="" id="cargo" name="cargo"  class="form-control"><?php ComboboxClass::showContent("tb_cargo", "cod_cargo", "nome"); ?></select> 
                                </div>

                            </div>
                            <div class="row">
                                <div class="col-md-3">   
                                    <label for="inputEmail">Telefone Fixo:</label>
                                    <input id="telefone_fixo" name="telefone_fixo" type="text" class="form-control"  placeholder="Digite o telefone">
                                </div>
                                <div class="col-md-4">   
                                    <label for="inputEmail">Telefone Celular:</label>
                                    <input  id="telefone_celular" name="telefone_celular" type="text" class="form-control"  placeholder="Digite o telefone">
                                </div>
                                <div class="col-md-5">
                                    <label for=""><span class="mandatory_field">* </span>Perfil:</label>
                                    <select required="" id="perfil" name="perfil" class="form-control"><?php ComboboxClass::showContent("tb_perfil", "cod_perfil", "nome"); ?></select> 
                                </div>

                            </div>

                        </div>

                    </div>

                </div>
                <?php
                TemplateClass::UPDATE_BUTTON();
                ?>
            </form>

            <?php
            TemplateClass::PREVIOUS_PAGE_BUTTON();
            ?>

        </div>

    </body>
</html>

